<template>
  <div id="main">
    <div class="top-box">
      <img @touchstart="goback" class="left-arrow" src="@/assets/书城/shape_u112.png" alt />
      <span :class="{greenfont:books==1}" @touchstart="gobook">书籍</span>
      <span :class="{greenfont:listen==2}" @touchstart="golisten">听书</span>
      <span :class="{greenfont:load==3}" @touchstart="goload">已下载</span>
      <img @touchstart="gosrc" width="16" height="16" src="@/assets/书架/u4050.png" alt />
    </div>
    <div class="midbox">
        <router-view/>
    </div>
    
  </div>
</template>

<script>
export default {
  data() {
    return {
      books: 1,
      listen:1,
      load:1
      
    };
  },
  methods:{
    gobook(){
        this.$router.push({
            path:'/books'
        },()=>{})
        this.listen=1,
        this.load=1,
        this.books=1
    },
    golisten(){
        this.$router.push({
            path:'/listen'
        },()=>{})
        this.listen=2,
        this.load=2,
        this.books=2
    },
    goload(){
      this.$router.push({
            path:'/load'
        },()=>{})
        this.listen=3,
        this.load=3,
        this.books=3
    },
    gosrc(){},
    goback(){
      this.$router.go(-1)
    }
  }
};
</script>

<style lang="less" scoped>
#main {
  width: 100%;
  .top-box {
    box-sizing: border-box;
    width: 100%;
    height: 1.6rem;
    display: flex;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 1);
    padding: 0 1.5rem;
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
    height: 5rem;
    position: fixed;
    top: 0;
    left: 0;
    border-bottom:.1rem solid  #f2f2f2;
    img {
      margin-top: .5rem;
    }
    .left-arrow {
      width: .9rem;
      height: 1.4rem;
    }
    span {
      font-family: "PingFangSC-Regular", "PingFang SC";
      font-weight: 400;
      font-style: normal;
      font-size: 1.6rem;
      color: #999999;
      text-align: center;
      height: 2.3rem;
      position: relative;
    }
    .greenfont {
      font-weight: bold;
      color: rgb(40, 208, 148);
      &::after {
        content: "";
        width: 2.7rem;
        height: .6rem;
        background-color: rgb(40, 208, 148);
        position: absolute;
        border-radius: .5rem;
        top: 122%;
        left: 50%;
        transform: translateX(-50%);
      }
    }
  }
  .midbox {
    margin-top: 6rem;
    padding: 0 1.5rem;
  }
  
}
</style>